from fastapi import FastAPI
from fastapi_pagination import add_pagination

from models import register_database
from middleware import register_middleware
from views import register_router

app = FastAPI()


# 注册路由
register_router(app)

# 开启分页
add_pagination(app)

# 注册中间件
register_middleware(app)

# 注册数据库
register_database()


if __name__ == '__main__':
    import uvicorn
    uvicorn.run("main:app", host="127.0.0.1", port=5000, reload=True)